package cn.baiweigang.uu.service.strategy;

import cn.baiweigang.uu.db.dataobj.StockInfoDo;
import cn.baiweigang.uu.enums.ExtKeyEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class Strategy3PService extends StrategyBaseService {

    public boolean isHit(StockInfoDo stockInfoDo) {
        //排除ST票
        if (isST(stockInfoDo)) {
            return false;
        }

        //东方财富排名1000以内
        if (stockInfoDo.getPm() > 1000) {
            return false;
        }

        //20均成交量大于1亿
        if (compareTo(stockInfoDo, "10000", ExtKeyEnum.MA20_E) > 0) {
            return false;
        }
        //6均 要大于20
        if (compareTo(stockInfoDo, ExtKeyEnum.MA20_C, ExtKeyEnum.MA6_C) > 0) {
            return false;
        }

        //5均 要大于20
        if (compareTo(stockInfoDo, ExtKeyEnum.MA20_C, ExtKeyEnum.MA5_C) > 0) {
            return false;
        }

        StockInfoDo preDay = queryPreDay(stockInfoDo, -1);
        //前一天的 5均 要小于20
        if (compareTo(preDay, ExtKeyEnum.MA5_C, ExtKeyEnum.MA20_C) > 0) {
            return false;
        }
        //今天的20均价 要大于前一天的20均价
        if (compareTo(preDay.getExtByKey(ExtKeyEnum.MA20_C.getCode()), stockInfoDo.getExtByKey(ExtKeyEnum.MA20_C.getCode())) > 0) {
            return false;
        }

        return true;
    }


}
